import request from '@/config/axios'

export interface GetMaterialsFormVO {
  id: number
  productNumber: string
  productName: string
  getMaterialsFormNumber: string
  productDrawingNumber: string
  productStandard: string
  dictGetMaterialsFormStatus: number
  approver: string
  approverName: string
  approverTime: Date
}

// 查询生产管理-工单管理-领料单列表
export const getGetMaterialsFormPage = async (params) => {
  return await request.get({ url: `/produce/get-materials-form/page`, params })
}

// 查询生产管理-工单管理-领料单详情
export const getGetMaterialsForm = async (id: number) => {
  return await request.get({ url: `/produce/get-materials-form/get?id=` + id })
}

// 新增生产管理-工单管理-领料单
export const createGetMaterialsForm = async (data: GetMaterialsFormVO) => {
  return await request.post({ url: `/produce/get-materials-form/create`, data })
}

// 修改生产管理-工单管理-领料单
export const updateGetMaterialsForm = async (data: GetMaterialsFormVO) => {
  return await request.put({ url: `/produce/get-materials-form/update`, data })
}

// 审批生产管理-工单管理-领料单
export const approveGetMaterialsForm = async (data: number[]) => {
  return await request.put({ url: `/produce/get-materials-form/commit`, data })
}

// 导出生产管理-工单管理-领料单 Excel
export const exportGetMaterialsForm = async (data) => {
  return await request.download({ url: `/produce/get-materials-form/export-excel`, data })
}

// 获取物料
export const getMaterialInfo = async (params) => {
  return await request.get({ url: `/produce/get-materials-form/getMaterialList`, params })
}

// 获取产品信息
export const getProductInfo = async (params) => {
  return await request.get({ url: `/produce/get-materials-form/getProductInfo`, params })
}

// 删除生产管理-工单管理-领料单物料
export const deleteGetMaterials = async (id: number) => {
  return await request.delete({ url: `/produce/get-materials-form-details/delete?id=` + id })
}